package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduSchoolLrIntegration;
import com.jwsoft.manager.common.vo.eduSchoolLr.EduSchoolLrVO;
import com.jwsoft.manager.common.vo.eduSchoolLr.EduSchoolLrKeyVO;
import com.jwsoft.manager.common.vo.eduSchoolLr.EduSchoolLrQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 学校可线下录入人数指标表管理网关
 *
 * @author zhiyuan
 * @since 2023-08-04
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学校可线下录入人数指标表管理", description = "学校可线下录入人数指标表管理")
public class EduSchoolLrController {

    @Autowired
    public EduSchoolLrIntegration eduSchoolLrIntegration;

    @Operation(summary = "学校可线下录入人数指标表管理分页查询",description = "学校可线下录入人数指标表管理分页查询")
    @PostMapping(value = "/eduSchoolLr0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSchoolLrVO>> getList(@RequestBody @Validated EduSchoolLrQueryVO vo) {
        return AppResponse.successData(eduSchoolLrIntegration.getList(vo));
    }

    @Operation(summary = "学校可线下录入人数指标表管理根据主键查询详情",description = "学校可线下录入人数指标表管理根据主键查询详情")
    @PostMapping(value = "/eduSchoolLr0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolLrVO> getById(@RequestBody @Validated EduSchoolLrKeyVO vo) {
        return AppResponse.successData(eduSchoolLrIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校可线下录入人数指标表管理新增",description = "学校可线下录入人数指标表管理新增")
    @PostMapping(value = "/eduSchoolLr0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolLrVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSchoolLrVO vo) {
        return AppResponse.successData(eduSchoolLrIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校可线下录入人数指标表管理修改",description = "学校可线下录入人数指标表管理修改")
    @PostMapping(value = "/eduSchoolLr0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSchoolLrVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSchoolLrVO vo) {
        return AppResponse.successData(eduSchoolLrIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学校可线下录入人数指标表管理删除",description = "学校可线下录入人数指标表管理删除")
    @PostMapping(value = "/eduSchoolLr0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSchoolLrKeyVO vo) {
        eduSchoolLrIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Operation(summary = "初始化学校人数指标信息",description = "初始化学校人数指标信息")
    @PostMapping(value = "/eduSchoolLr0007", produces = "application/json;charset=UTF-8")
    public AppResponse initializeSchoolLr(@RequestBody @Validated EduSchoolLrKeyVO vo) {
        eduSchoolLrIntegration.initializeSchoolLr(vo);
        return AppResponse.successMsg("初始化成功！");
    }

}
